<!DOCTYPE html>
<html lang="zh-cmn-Hans">
  <head>
    <meta charset="UTF-8">
    <meta content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" name="viewport" />
    <meta content="yes" name="apple-mobile-web-app-capable" />
    <meta content="black" name="apple-mobile-web-app-status-bar-style" />
    <meta name="format-detection" content="telephone=no" />
    <link rel="stylesheet" href="../../static/mobile/default/css/layout.css?v=2"/>
    <link rel="icon" type="image/png" href="../../static/favicon.ico"/>
        <script src="../../static/js/jquery/jquery/2.1.4/jquery.min.js"></script>
    <script src="../../static/js/jquery/jquery.cookie.js"></script>
    <script src="../../static/mobile/default/js/page.js?v=1"></script>
    <title>评论中心  - 达漂亮</title>
          
<link rel="stylesheet" href="../../static/mobile/default/css/my.css" />


</head>
<body >
  <div class="page evaluate">
    		<div class="page-hd">
            <div class="header base-header bor-1px-b">
                <div class="header-left">
                    <a href="javascript:history.go(-1)" class="left-arrow"></a>
                </div>
                <div class="header-title">评论中心</div>
                <div class="header-right">
                    <!-- <a href=""></a> -->
                </div>
            </div>
        </div>
      
<div class="tab fs32 ">
        <div class="color_9 orderActive" data-type="wait">待评价<span class="fs26 wait_num"></span></div>
        <div class="color_9" data-type="end">已评价<span class="fs26"></span></div>
      </div>

 <div class="page-bd">
        <!-- 页面内容-->
          <div class="tabBox">
              <div class="tabBlock ">
                <div id="waitBox"></div>
              </div>
              <div class="tabBlock box">
                  <div id="endBox"></div>
              </div>
          </div>

 </div>



  </div>

<script src="../../static/js/art-template.js"></script>
<script src="../../static/mobile/default/js/lib/fastclick.js"></script>
<script src="../../static/js/jquery/lazyload/jquery.lazyload.js"></script>
<script>
    $(function() {
        FastClick.attach(document.body);
		$("img.lazy").lazyload({effect:"fadeIn",event:"scroll",container:$(".page-bd")});
    });
</script>


  <script id="goodsTpl" type="text/html">
        {{each list as item index}}
        <div class="goodsBox">
            <img src={{item.pic}} alt=""> 
            <div class="info">
              <div class="name fs28 color_3 textline_1">{{item.goods_name}}</div>
              <div class="type fs28 color_9">{{item.sku_name}}</div>
              <div class="infoBott">
                <div class="money">
                    <div class="color_3 fs24 num"><p class="fw_b fm_p">￥</p><em class="fs36">{{item.exp_price[0]}}</em><p>.{{item.exp_price[1]}}</p></div>
                    <div class="fs24 color_9 originalMoney">￥{{item.shop_price}}</div>
                </div>
				{{if item.is_evaluate == 1}}
                <a class="butt color_r fs28" href="/shop/comment/comment/rec_id/{{item.rec_id}}.html">评价</a>
				{{else}}
				<a class="butt color_3 fs28 borColor_e" href="/shop/comment/view/rec_id/{{item.rec_id}}.html"">查看评价</a>
				{{/if}}
              </div>
            </div>                  
        </div>
        {{/each}}
      
   </script>

    <script>
	 var nowPage = [],getAgain = [],isLoadend = [];
	 var _type = 'wait';
	function getList(isagain){
		page = nowPage[_type];
        if (typeof(page) == 'undefined') page = 1;
		if (isLoadend[_type] == true ) return false;
		if (isagain == true){
			if (getAgain[_type] == false) return false;
			getAgain[_type] = false;
		}else{
			$('.'+_type+'Box').append('<div class="get_list_tip" data-type="'+_type+'">加载数据中...</div>');
		}
		
		isLoadend[_type] = true;
		jq_ajax('/shop/api.comment/getlist.html','type='+_type+'&p='+page,function(res){
			isLoadend[_type] = false;
			if(res.code  == 0 ){
				  _alert(res.errmsg);
				  getAgain[_type] = true;
				  $('.'+_type+'Box').find('.get_list_tip').html('加载失败，点击重新加载.');
				  return false;
			}
			$('#'+_type+'Box').append(template('goodsTpl',res));
			if (_type == 'wait'){
				$('.wait_num').html('('+res.total_count+')');	
			}
			nowPage[_type] = page+1;
			$('#'+_type+'Box').find('.get_list_tip').remove();
			if (res.page_count == page) {
                 $('.'+_type+'Box').append('<div class="get_list_tip">---我也有底线的---</div>');
                 isLoadend[_type] = true;
             }
		})	
	}
       $(function(){
		getList();
        $('.tab div').on('click',function(){
             var index=$(this).index();
             $(this).addClass('orderActive')
             $(this).siblings().removeClass('orderActive')
             $('.tabBlock').eq(index).show();
             $('.tabBlock').eq(index).siblings().hide();
			 _type = $(this).data('type');
			 if ($('#'+_type+'Box').html() == ''){
					isLoadend[_type] = false;
					getAgain[_type] = false;
					getList();//执行加载
			 }
           })
       })
       $('.tabBlock').scroll(function(){  
         if($(this).children('div').height()-$(this).height()-$(this).scrollTop()<50){
           getList();
         }
       })
    </script>



  <div class="alertBox">
      <div class="alertBG"></div>
      <div class="alert">
          <div class="text fs30 color_3 bor_b">

          </div>
          <!-- 单按钮 -->
          <div class="button fs32 fw_b color_r">
              知道了
          </div>
          <!-- 双按钮 -->
          <div class="buttonBox fs32 fw_b">
              <span class="color_9 bor_r cancel">取消</span>
              <span class="color_r confirm">确定</span>
          </div>
      </div>
  </div>
  <script type="text/javascript">
      var is_xcx = 0;
      $(document).on('click', 'a', function () {
          var href = $(this).attr('href');
          if (href.indexOf('/pages') != -1) {
              if (is_xcx == 1) {
                  wx.miniProgram.navigateTo({
                      url: href
                  })
                  return false;
              } else {
                  return false;
              }
          }
      })
  </script>
    </body>
</html>